package org.montecristo.posmobile.previo;

import org.montecristo.posmobile.previo.base.ManagerDB;
import org.montecristo.posmobile.previo.clases.encuesta.Applicacion;
import org.montecristo.posmobile.previo.clases.encuesta.Previo;

import android.os.Build;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.widget.TextView;
//import android.support.v4.app.NavUtils;
import android.text.Html;

import org.montecristo.posmobile.R;

public class infoAplicacion extends Activity {

	ManagerDB man;
	TextView refero,pednumo,conteno,tipoconteno,
			 numobl,merco,sellos,recinto,buquo,facto,provedo,paiso,cajas;
	
   @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        if (Build.VERSION.SDK_INT < 11){
        	this.requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.layout_applicacion);
        
        }else{
			    setContentView(R.layout.layout_applicacion_no_action_bar);
			    android.app.ActionBar actionBar = getActionBar();
			    actionBar.setDisplayHomeAsUpEnabled(true);
			    actionBar.setTitle("Informacion");
            }
        
        
      
        //setContentView(R.layout.main_layout_info);
        Intent myIntent= getIntent();
        String idApp = myIntent.getStringExtra("idApp");
        man = new ManagerDB(this);
        Applicacion app = man.getApplicacionById(idApp);
        Previo pre = app.getPrevio();
        
              
        refero = (TextView) findViewById(R.id.textRef);
        pednumo = (TextView) findViewById(R.id.textPedNum);
        conteno = (TextView) findViewById(R.id.textCont);
        tipoconteno = (TextView) findViewById(R.id.textTipoCont);
        numobl = (TextView) findViewById(R.id.textBL);
        merco = (TextView) findViewById(R.id.textMerca);
        sellos = (TextView) findViewById(R.id.textSellos);
        recinto = (TextView) findViewById(R.id.textRecinto);
        buquo = (TextView)	findViewById(R.id.textBuque);
        facto = (TextView) findViewById(R.id.textFact);
        provedo = (TextView) findViewById(R.id.textProov);
        paiso = (TextView) findViewById(R.id.textPais);
        cajas = (TextView) findViewById(R.id.textCajas);      
        
       
        refero.setText(Html.fromHtml("<b>"+ refero.getText() +" </b> "+pre.getReferencia()));
        pednumo.setText(Html.fromHtml("<b>" + pednumo.getText() +" </b> "+pre.getPedimento()));
        conteno.setText(Html.fromHtml("<b>" + conteno.getText() + " </b> "+pre.getContenedor()));
        tipoconteno.setText(Html.fromHtml("<b>" + tipoconteno.getText() + " </b> "+pre.getTipoContenedor()));
        numobl.setText(Html.fromHtml("<b>" + numobl.getText() + " </b> "+pre.getBL()));
        merco.setText(Html.fromHtml("<b>" + merco.getText() + " </b> "+pre.getMercancia()));
        sellos.setText(Html.fromHtml("<b>" + sellos.getText() + " </b> "+pre.getSellosOrigen()));
        recinto.setText(Html.fromHtml("<b>" + recinto.getText() + ": </b> "+pre.getOperadora()));
        buquo.setText(Html.fromHtml("<b>" + buquo.getText() + " </b> "+pre.getBuque()));
        facto.setText(Html.fromHtml("<b>" + facto.getText() +" </b> "+pre.getFacturas()));
        provedo.setText(Html.fromHtml("<b>" + provedo.getText() + " </b> "+pre.getProveedor()));
        paiso.setText(Html.fromHtml("<b>" + paiso.getText() + " </b> "+pre.getPais()));
        cajas.setText(Html.fromHtml("<b>" + cajas.getText() + " </b>"+pre.getCajas()));
        
    }

   @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        //getMenuInflater().inflate(R.menu.activity_info_aplicacion, menu);
        return true;
    }

   @Override
    public void startActivity(Intent intent) {
    	// TODO Auto-generated method stub
    	super.startActivity(intent);
    	overridePendingTransition(R.anim.animation_leave,R.anim.animation_enter);
    }
    
   @Override
    public void onBackPressed() {
        super.onBackPressed();        
        overridePendingTransition(R.anim.animation_leaver,R.anim.animation_enterr);
    }
    
}
